package a01_Thread;

/**
 * @Author quan
 * @Description runnable接口使用匿名内部类的方式
 * @Date 2023/4/26 11:12
 */
public class Demo5_runnableAnno {
    public static void main(String[] args) {
        Thread t = new Thread(new Runnable() {
            @Override
            public void run() {
                while (true){
                    System.out.println("生产皮包，金币+1");
                    try {
                        Thread.sleep(1000);
                    } catch (InterruptedException e) {
                        throw new RuntimeException(e);
                    }
                }
            }
        });
        //开启线程
        t.start();
    }
}
